/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thinkinginjava.svn.strings.regularexpressions;

import java.util.regex.Matcher;
import java.util.regex.Pattern;
import thinkinginjava.svn.io.text.TextFile;

/**
 *
 * @author public_enemy
 */
public class JGrep {

    public static void main(String[] args) {
        Pattern p = Pattern.compile("\\w+");
        int index = 0;
        Matcher m = p.matcher(" ");
        for (String line : new TextFile("text2.txt")) {
            m.reset(line);
            while (m.find()) {
                System.out.println(index++ + " : " + m.group()
                        + " : " + m.start());
            }
        }
    }
}
